﻿using SqlSugar;
using Zhp.SqlSugar.Entity;

namespace Zhp.Entity.Chat
{
    /// <summary>
    /// A和B聊天存储A,B;B,A两条数据方便查询
    /// </summary>
    [SugarTable("Chat_User")]
    public class ChatUser : BaseEntity<ChatUser, long>
    {
        /// <summary>
        /// 好友主键ID
        /// </summary>
        [SugarColumn(ColumnDataType = "bigint", IsNullable = false, ColumnDescription = "好友主键ID")]
        public long MainId { get; set; }

        /// <summary>
        /// 聊天用户ID
        /// </summary>
        [SugarColumn(ColumnDataType = "bigint", IsNullable = false, ColumnDescription = "聊天用户ID")]
        public long UserId { get; set; }

        /// <summary>
        /// 聊天用户名称
        /// </summary>
        [SugarColumn(ColumnDataType = "nvarchar", Length = 10, IsNullable = false, ColumnDescription = "聊天用户名称")]
        public string NickName { get; set; }

        /// <summary>
        /// 聊天对方用户ID
        /// </summary>
        [SugarColumn(ColumnDataType = "bigint", IsNullable = false, ColumnDescription = "聊天对方用户ID")]
        public long TouserId { get; set; }

        /// <summary>
        /// 聊天对方好友备注
        /// </summary>
        [SugarColumn(ColumnDataType = "nvarchar", Length = 10, IsNullable = false, ColumnDescription = "聊天对方好友备注")]
        public string ToNickName { get; set; }

        /// <summary>
        /// 是否为群聊
        /// </summary>
        [SugarColumn(ColumnDataType = "bit", IsNullable = false, ColumnDescription = "是否为群聊")]
        public bool IsGroupChat { get; set; }

        /// <summary>
        /// 互为好友共用ID,用作查询聊天记录
        /// </summary>
        [SugarColumn(ColumnDataType = "bigint", IsNullable = false, ColumnDescription = "互为好友共用ID,用作查询聊天记录")]
        public long PairID { get; set; }

        /// <summary>
        /// 是否隐藏
        /// </summary>
        [SugarColumn(ColumnDataType = "bit", IsNullable = false, ColumnDescription = "是否隐藏")]
        public bool IsHide { get; set; }

        /// <summary>
        /// 排序，可以用来做置顶功能
        /// </summary>
        [SugarColumn(ColumnDataType = "decimal", IsNullable = false, ColumnDescription = "聊天用户ID")]
        public decimal Order { get; set; }

        /// <summary>
        /// 最新消息
        /// </summary>
        [SugarColumn(ColumnDataType = "nvarchar", Length = 255, IsNullable = true, ColumnDescription = "最新消息")]
        public string LastMessage { get; set; }

        /// <summary>
        /// 最新时间
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "最新时间")]
        public DateTime LastTime { get; set; }
    }
}
